<template>
	<view class="content" :style="app_bg">
		<view class="topTitle" :style="'top:'+zhuangtai+'px'">
			<image class="back" @click="backClick" :src="pubilcPopupImg.btn_back" mode=""></image>
			<view class="" style="font-size: 32rpx;">
				闯关答题
			</view>
		</view>
		<view class="listindex font34" :style="page_top">
			<image class="bgimgpublic" style="z-index: 0;" :src="pubilcPopupImg.question_bg_image" mode=""></image>
			<image class="avatar" :src="avatar" mode=""></image>
			<view class="userinfo">
				<text class="text1 font30" :style="font_1st">{{user_name}}</text>
				<text class="font28" v-if="question_cost_type == 1" :style="font_3rd">目前拥有{{appConfig.gold_coin_name}}*{{gold_coin}}</text>
				<text class="font28" v-if="question_cost_type == 2" :style="font_3rd">目前拥有{{appConfig.game_coin_name}}*{{game_coin}}</text> 
				<text class="font28" v-if="question_cost_type == 3" :style="font_3rd">目前拥有{{appConfig.exp_name}}*{{exp}}</text>
				<text class="font28" v-if="question_cost_type == 4" :style="font_3rd">目前拥有{{appConfig.money_name}}*{{money}}</text>
			</view>
		</view>
		<view class="answerindex" :style="app_theme">
			<view class="stroke">
				<cmd-progress :stroke-color="publicTextColor.app_border_color" type="circle" :percent="numbers" :showInfo="false"></cmd-progress>
				<view class="stroke_text" :style="font_3rd">
					<view class="font60 text1" :style="font_1st">{{numberInterval}}</view>
				 </view>
			</view>
			<block v-if="!startquestion" v-for="(item, index) in question_list" :key="index">
				<block v-if="listindex == index">
					<view class="questiontext font34" :style="font_1st">
						{{item.name}}
					</view>
					<block v-if="item.type == 1">
						<view class="btn" v-if="item.option_1!=''" @click="answerchange(item,1,index)" :style="isclickanswer ? (yesid == 1?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 1 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=1 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_1}}</view>
						</view>
						<view class="btn" v-if="item.option_2!=''" @click="answerchange(item,2,index)" :style="isclickanswer ? (yesid == 2?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 2 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=2 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_2}}</view>
						</view>
						<view class="btn" v-if="item.option_3!=''" @click="answerchange(item,3,index)" :style="isclickanswer ? (yesid == 3?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 3 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=3 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_3}}</view>
						</view>
						<view class="btn" v-if="item.option_4!=''" @click="answerchange(item,4,index)" :style="isclickanswer ? (yesid == 4?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 4 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=4 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_4}}</view>
						</view>
					</block>
					<block v-if="item.type == 2">
						<view class="btn" v-if="item.option_1!=''" @click="answerchange(item.is_gold_coin)" :style="isclickanswer ? (yesid == 0?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 0 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=0 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_1}}</view>
						</view>
						<view class="btn" v-if="item.option_2!=''" @click="answerchange(item.is_gold_coin)" :style="isclickanswer ? (yesid == 1?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 1 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=1 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_2}}</view>
						</view>
						<view class="btn" v-if="item.option_3!=''" @click="answerchange(item.is_gold_coin)" :style="isclickanswer ? (yesid == 2?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 2 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=2 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_3}}</view>
						</view>
						<view class="btn" v-if="item.option_4!=''" @click="answerchange(item.is_gold_coin)" :style="isclickanswer ? (yesid == 3?question_theme_color:question_second_color):answer_border_color">
							<image class="yesimg" v-if="yesid == 3 && isclickanswer" :src="answer.yes" mode=""></image>
							<image class="noimg" v-if="yesid !=3 && isclickanswer" :src="answer.no" mode=""></image>
							<view class="font34 fontw500" :style="question_fond_color">{{item.option_4}}</view>
						</view>
					</block>
				</block>
			</block>
		</view>
		<view class="progressindex" >
			<image class="image1" :src="pubilcPopupImg.question_progress_bar_start_icon" mode=""></image>
			<view class="progressline" :style="'border: 1rpx solid '+publicTextColor.font_tips_color+';backgrond:'+publicTextColor.app_bg_color+';'">
				<view class="progresslinein" :style="'background:'+publicTextColor.question_progress_bar_color+';width:'+readyline+'%;'"></view>
			</view>
			<image class="image2" :src="pubilcPopupImg.question_progress_bar_end_icon" mode=""></image>
			<view class="numbertext" :style="font_1st">{{trueYesNumber}}/{{question_item_count}}</view>
		</view>
		<uni-popup ref="successQuestion" type="center" :maskClick="false">
			<view class="successsynpopup" :style="app_theme">
				<image class="popuptop" :src="pubilcPopupImg.question_success_icon" mode=""></image>
				<view class="successtop">
					<image class="bgimgpublic" style="z-index: 0;" :src="pubilcPopupImg.alert_success_image_1" mode=""></image>
					<text class="font48 fontw index-1"  style="margin-top: -19rpx;"
						:style="font_1st"
					>
						闯关成功
					</text>
				</view>
				<view class="avatar">
					<image class="bgimgpublic" style="z-index: 0;" :src="answer.userbgimg" mode=""></image>
					<image class="image1" :src="avatar" mode=""></image>
				</view>
				<text class="username font34" :style="font_1st">{{user_name}}</text>
				<text class="getnumber font30" :style="font_1st">恭喜获得{{questionSuccessDesc}}</text>
				<text class="other" :style="font_1st">今日剩余双倍次数：
					<text :style="font_1st">{{rewarded_video_ad_multiple_daily_times}}</text>
				</text>
				<view class="successbtn" @click="beforeLookAdVideo" v-if="rewarded_video_ad_multiple_daily_times>0 && !is_only_card">
					<image class="bgimgpublic" style="z-index: 0;" :src="pubilcPopupImg.btn_sm_warm" mode=""></image>
					<image class="answervideo" :src="pubilcPopupImg.btn_ad_unit" mode=""></image>
					<text class="font36 index-1" :style="font_1st">领取</text>
				</view>
				<text class="font34" @click="getCurronGift(0)" :style="font_3rd">普通领取</text>
			</view>
		</uni-popup>
		<uni-popup ref="fileprogress" type="center" :maskClick="false">
			<view class="successsynpopup" :style="app_theme">
				<image class="popuptopfile" :src="pubilcPopupImg.question_fail_icon" mode=""></image>
				<view class="successtop">
					<image class="bgimgpublic index-0" :src="pubilcPopupImg.alert_fail_image_1" mode=""></image>
					<text class="font48 fontw index-1" style="margin-top: -19rpx;"
						:style="font_1st"
					>
						闯关失败
					</text>
				</view>
				<view class="stroke">
					<cmd-progress :stroke-color="publicTextColor.app_border_color" type="circle" :percent="rebornStart" :showInfo="false"></cmd-progress>
					<view class="stroke_text" :style="'background:'+publicTextColor.font_3rd_color+';'">
						<view class="font60 text1" :style="font_1st">{{reborn_wait_second}}</view>
					 </view>
				</view>
				<text class="resurrectiontitle font34" v-if="reborn_type == 2" :style="font_1st">当前还未获得奖励
					转发小程序给好友可继续答题哦~
				</text>
				<text class="resurrectiontitle font34" v-if="reborn_type == 1" :style="font_1st">当前还未获得奖励
					观看视频复活可继续答题哦~
				</text>
				<text class="font48 fontw" :style="'margin-bottom:60rpx;color:'+publicTextColor.font_tips_color+';'">等待复活</text>
				<button class="successbtn" type="default" open-type="share" v-if="reborn_type == 2" @click="isClickShareBtn = true">
					<image class="bgimgpublic index-0" :src="pubilcPopupImg.btn_sm_primary" mode=""></image>
					<text class="font36 index-1" :style="font_1st">转发小程序复活</text>
				</button>
				<view class="successbtn" v-if="reborn_type == 1" @click="clickReborn(1)">
					<image class="bgimgpublic index-0" :src="pubilcPopupImg.btn_sm_warm" mode=""></image>
					<text class="font36 index-1" :style="font_1st">立即复活</text>
				</view>
				<view class="filebtn" @click="clickReborn(0)">
					<image class="bgimgpublic index-0" :src="pubilcPopupImg.btn_sm_disabled" mode=""></image>
					<text class="font36 index-1" :style="font_1st">放弃复活</text>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import cmdProgress from "@/components/cmd-progress/cmd-progress.vue"
	var util = require('@/js/util.js')
	export default {
		components: {cmdProgress},
		data() {
			return {
				publicTextColor:"",
				pubilcPopupImg:"",
				zhuangtai:0,
				numberInterval:0,
				lineInterval:10,
				numbers:0,
				yesid:-1,
				noid:0,
				user_name:"",
				avatar:'',
				question_list:[],
				listindex:0,
				startquestion:false,
				money:0,
				gold_coin:0,
				game_coin:0,
				exp:0,
				question_cost_type:0,
				question_cost_amount:0,
				listanswer:-1,
				isclickanswer:false,
				quesitonbacktime:"",
				questionSuccessDesc:"",
				question_order_id:"",
				rewarded_video_ad_multiple_daily_times:0,
				reborn_wait_second:0,
				reborn_amount:0,
				rebornStart:0,
				isYes:0,
				currentIndex:0,
				isReborn:0,
				rebornIntervar:"",
				trueYesNumber:0,
				rewarded_ad_unit:"",
				openVideo:null,
				reborn_type:"",
				isClickShareBtn:false,
				is_rewarded_ad:0,
				question_item_count:0,
				readyline:0,
				rebornTime:0,
				isRebornOrDouble:0,
				is_reward:0,
				is_finish:0,
				appConfig:'',
				is_only_card:false,
				answer_click_number:0
			};
		},
		onShareAppMessage() { // 分享 buttom share
			this.rebornShare()
			return {
				title: '合成王者',
				path: '/pages/index/index?parent_id='+uni.getStorageSync('member_id')
			}
		},
		onHide() {
			clearInterval(this.rebornIntervar)
			clearInterval(this.quesitonbacktime)
		},
		onUnload() {
			clearInterval(this.rebornIntervar)
			clearInterval(this.quesitonbacktime)
		},
		onShow() {
			if(!this.isClickShareBtn){
				this.loadData()
			}
			let that = this
			let aniosgaodu = 0
			uni.getSystemInfo({
				success: function(res) {
					console.log(res);
					that.zhuangtai = res.statusBarHeight;
					var a = res.model.split(' ');
					if (a[0] == 'iPhone') {
						aniosgaodu = 44;
					} else {
						aniosgaodu = 48;
					}
					that.zhuangtai = parseInt(that.zhuangtai)+4
					console.log(that.zhuangtai)
				}
			});
		},
		onLoad() {
			this.setcolorConfig()
		},
		computed:{
			user_margin_top(){
				return `margin-top:${(this.zhuangtai+52)}px;background:${this.publicTextColor.app_theme_color};`
			},
			question_fond_color(){
				return `color:${this.publicTextColor.question_fond_color};`
			},
			answer_border_color(){
				return `background:${this.publicTextColor.app_border_color};`
			},
			question_second_color(){
				return `background:${this.publicTextColor.question_second_color};`
			},
			question_theme_color(){
				return `background:${this.publicTextColor.question_theme_color};`
			},
			page_top(){
				return `margin-top:${(this.zhuangtai+52)}px;`
			},
			app_border_top(){
				return `border-top:2rpx solid ${this.publicTextColor.app_border_color};`
			},
			app_border_bottom(){
				return `border-bottom:2rpx solid ${this.publicTextColor.app_border_color};`
			},
			app_theme(){
				return `background:${this.publicTextColor.app_theme_color};`
			},
			app_bg(){
				return `background:${this.publicTextColor.app_bg_color};`
			},
			font_3rd(){
				return `color:${this.publicTextColor.font_3rd_color};`
			},
			font_2nd(){
				return `color:${this.publicTextColor.font_2nd_color};`
			},
			font_1st(){
				return `color:${this.publicTextColor.font_1st_color};`
			}
		},
		methods:{
			rebornShare(){
				let _self = this
				uni.request({
					url: util.getUrl("question/reborn_share"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
					},
					method: 'POST',
					success: res => {
						console.log("?????????",res )
						if(res.data.code == 1){
							uni.showToast({
								title:'转发成功',
								icon:'none'
							})
							// _self.currentIndex++
							_self.$refs.fileprogress.close()
							_self.isYes = 1
							_self.isReborn = 1
							_self.postAnswerquestion()
						}
					},
				});
			},
			getRebornConfig(){
				let _self = this
				uni.request({
					url: util.getUrl("question/reborn_times"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
						question_order_id:_self.question_order_id,
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							_self.reborn_amount = res.data.data.reborn_amount
							_self.rewarded_ad_unit = res.data.data.rewarded_ad_unit
							_self.reborn_type = res.data.data.reborn_type
						}
					},
				});
			},
			getCurronGift(is_rewarded_ad){
				let _self = this
				uni.request({
					url: util.getUrl("question/reward"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
						question_order_id:_self.question_order_id,
						sort:_self.currentIndex,
						is_rewarded_ad:is_rewarded_ad //是否翻倍
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							_self.$refs.successQuestion.close() //奖品领取弹窗关闭
							_self.isclickanswer = false //是否选择答案，用于显示对错
							_self.listindex++ //切换下一题
							if(_self.is_finish==1){ //如果答对超过5，则答题结束
								uni.reLaunch({
									url:'index'
								})
							}else{
								_self.backtime()//下一题计时开始
							}
						}else{
							uni.showToast({
								title:res.data.msg,
								icon:'none'
							})
						}
					},
				});
			},
			//--------------------用户是否选择复活---------------------
			clickReborn(type){  //  1复活 其他不复活
				let _self = this
				if(type == 1){
					_self.isYes = 1 //复活算则答对
					_self.is_rewarded_ad = 0 //不翻倍
					_self.isRebornOrDouble = 1
					_self.lookAdVideo()
				}else{
					_self.isYes = 0
					_self.postIsReborn()
				}
			},
			//--------------------用户选择复活---------------------
			postIsReborn(){
				let _self = this
				uni.request({
					url: util.getUrl("question/reborn_expire"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
						question_order_id:_self.question_order_id,
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							clearInterval(this.rebornIntervar)
							this.$refs.fileprogress.close()
							uni.reLaunch({
								url:'index'
							})
						}
					},
				});
			},
			loadData(){
				let _self = this
				uni.request({
					url: util.getUrl("question/start"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							_self.user_name = res.data.data.nickname
							_self.avatar = res.data.data.avatar
							_self.money = res.data.data.money
							_self.gold_coin = res.data.data.gold_coin
							_self.game_coin = res.data.data.game_coin
							_self.exp = res.data.data.game_coin
							_self.question_cost_type = res.data.data.question_cost_type
							_self.question_cost_amount = res.data.data.question_cost_amount
							_self.question_list = res.data.data.question_list
							_self.startquestion = false
							_self.question_order_id = res.data.data.question_order_id
							_self.reborn_wait_second = res.data.data.reborn_wait_second
							_self.question_item_count = res.data.data.question_item_count
							_self.rewarded_video_ad_multiple_daily_times = res.data.data.rewarded_video_ad_multiple_daily_times
							_self.rebornTime = res.data.data.reborn_wait_second
							_self.getLine()
							_self.getRebornConfig()
							_self.backtime()
						}else{
							if(res.data.code == 500){
								uni.navigateTo({
									url:'../../pages/login/login'
								})
								uni.showToast({
									title:res.data.msg,
									icon:'none'
								})
							}
						}
					},
				});
			},
			updateloadData(){
				let _self = this
				uni.request({
					url: util.getUrl("question/start"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							_self.rewarded_video_ad_multiple_daily_times = res.data.data.rewarded_video_ad_multiple_daily_times
						}else{
							if(res.data.code == 500){
								uni.navigateTo({
									url:'../../pages/login/login'
								})
								uni.showToast({
									title:res.data.msg,
									icon:'none'
								})
							}
						}
					},
				});
			},
			setcolorConfig(){
				this.pubilcPopupImg = uni.getStorageSync("diyImg")
				this.publicTextColor = uni.getStorageSync("diyColor")
				this.appConfig = uni.getStorageSync("appconfig")
			},
			
			//------------------------答题判断对错---------------------
			answerchange(item,itemid,index){
				console.log(item)
				this.answer_click_number++
				console.log(this.answer_click_number,"123111111111111589999999999999")
				clearInterval(this.quesitonbacktime)
				let _self = this
				if(_self.answer_click_number == 1){
					_self.currentIndex = index+1 //当前题目索引
					_self.is_reward = item.is_reward
					if(_self.listanswer == itemid){ //判断答案跟选择的选项是否一致
						_self.isYes = 1  //正确为1
						_self.is_rewarded_ad = 0 //是否翻倍
						_self.isReborn = 0  //是否复活
						_self.postAnswerquestion()
					}else{
						_self.isYes = 0
						_self.is_rewarded_ad = 0
						_self.$refs.fileprogress.open()
						_self.rebornwaitTime()
						clearInterval(_self.quesitonbacktime)
					}
					_self.yesid = _self.listanswer
					_self.isclickanswer = true
				}
			},
			//------------------------答题判断对错---------------------
			
			//------------------------底部答题进度条----------------*--
			getLine(){
				this.readyline = (this.trueYesNumber/this.question_item_count)*10000/100.00
			},
			//------------------------底部答题进度条----------------*--
			
			//--------------------答题奖励-------------------
			postAnswerquestion(){
				let _self = this 
				_self.answer_click_number = 0
				uni.request({
					url: util.getUrl("question/answer"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
						question_order_id:_self.question_order_id,
						sort:_self.currentIndex, //当前第几题
						answer_result:_self.isYes,//是否答对
						is_reborn:_self.isReborn,//是否复活
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							_self.reborn_wait_second = _self.rebornTime //复活倒计时重置
							_self.is_finish = res.data.data.is_finish
							_self.$refs.fileprogress.close() //关闭复活弹窗
							_self.trueYesNumber ++ //答对题目次数+1
							_self.getLine() //更改进图条进度 
							let show_only_card = false
							
							if(_self.is_reward == 1 && _self.isReborn !=1){
								if(res.data.data.reward.is_gold_coin == 1){
									show_only_card = true
									_self.questionSuccessDesc += " "+_self.appConfig.gold_coin_name+"*"+res.data.data.reward.gold_coin
								}
								if(res.data.data.reward.is_game_coin == 1){
									show_only_card = true
									_self.questionSuccessDesc += " "+_self.appConfig.game_coin_name+"*"+res.data.data.reward.game_coin
								}
								if(res.data.data.reward.is_exp == 1){
									show_only_card = true
									_self.questionSuccessDesc += " "+_self.appConfig.exp_name+"*"+res.data.data.reward.exp
								}
								if(res.data.data.reward.is_money == 1){
									show_only_card = true
									_self.questionSuccessDesc += " "+_self.appConfig.money_name+"*"+res.data.data.reward.money
								}
								if(res.data.data.reward.is_card == 1){
									if(show_only_card){
										_self.is_only_card = true
									}else{
										_self.is_only_card = false
									}
									_self.questionSuccessDesc += " 卡片"+res.data.data.reward.card[0].name+'*1'
								}
								_self.$refs.successQuestion.open()
								clearInterval(_self.quesitonbacktime)
							}else{
								if(_self.is_finish == 1){
									clearInterval(_self.rebornIntervar)
									uni.reLaunch({
										url:'index'
									})
								}else{
									uni.showModal({
										title:'提示',
										content:'回答正确，点击继续答题',
										confirmText:"继续",
										showCancel:false,
										success:(res)=>{
											if(res.confirm){
												_self.isclickanswer = false //是否选择答案，用于显示对错
												_self.listindex++ //切换下一题
												_self.backtime()//下一题计时开始
											}
										}
									})
								}
							}
							_self.isReborn = 0 //重置复活状态
						}else{
							uni.showToast({
								title:res.data.msg,
								icon:'none'
							})
							if(res.data.code == 0){
								uni.showModal({
									title:'提示',
									content:res.data.msg+'，闯关失败',
									showCancel:false,
									confirmText:'返回',
									success: (res) => {
										if(res.confirm){
											uni.reLaunch({
												url:'index'
											})
										}
									}
								})
							}
						}
					},
				});
			},
			//--------------------答题奖励-------------------
			rebornwaitTime(){
				let time = this.reborn_wait_second
				this.rebornIntervar = setInterval(()=>{
					this.reborn_wait_second -- 
					this.rebornStart =100-(this.reborn_wait_second/time*100)
					console.log(this.rebornStart,"answer")
					if(this.reborn_wait_second<=0){
						clearInterval(this.rebornIntervar)
						this.$refs.fileprogress.close()
						this.clickReborn(0)
					}
				},1000)
			},
			backtime(){
				this.numberInterval = this.question_list[this.listindex].answer_second
				this.listanswer = this.question_list[this.listindex].answer
				this.quesitonbacktime = setInterval(()=>{
					this.numberInterval --
					this.numbers =100-(this.numberInterval/this.question_list[this.listindex].answer_second*100)
					if(this.numberInterval<=0){
						clearInterval(this.quesitonbacktime)
						if(this.listindex <this.question_list.length){
							if(!this.isclickanswer){
								this.currentIndex++
								this.isYes = 0
								this.is_rewarded_ad = 0
								this.$refs.fileprogress.open()
								this.rebornwaitTime()
								clearInterval(this.quesitonbacktime)
							}else{
								this.currentIndex++
								this.isclickanswer = false
								this.backtime()
							}
						}else{
							uni.navigateBack({
								
							})
						}
					}
				},1000)
			},
			beforeLookAdVideo(){
				this.isRebornOrDouble = 2
				this.lookAdVideo()
			},
			lookAdVideo(){  //type :1 复活视频 2 翻倍视频
				let _self = this
				if(_self.openVideo == null){
					_self.openVideo = uni.createRewardedVideoAd({
						adUnitId:_self.rewarded_ad_unit,
					})
					_self.openVideo.load((resLoad)=>{
						console.log("adload",resLoad)
					})
					_self.openVideo.onError(function(eError){
						console.log("eError",eError)
					})
					_self.openVideo.onClose((res)=>{
						if(res && res.isEnded){
							console.log(_self.isRebornOrDouble)
							if(_self.isRebornOrDouble == 1){
								_self.isReborn = 1 
								if(_self.is_reward == 1){
									_self.postAnswerquestion()
								}else{
									if(_self.is_finish == 1){
										uni.reLaunch({
											url:'index'
										})
									}else{
										_self.postAnswerquestion()
									}
								}
							}
							if(_self.isRebornOrDouble == 2){
								_self.is_rewarded_ad = 1
								_self.getCurronGift(1)
							}
						}
					})
				}
				clearInterval(_self.rebornIntervar)
				_self.openVideo.show()
					.catch(() => {
						_self.openVideo.load()
							.then(() => {
								_self.openVideo.show()
							})
							.catch(err => {
								console.log('激励视频 广告显示失败')
								uni.showToast({
									title: '暂无激励视频',
									icon: 'none',
									duration: 2000
								});
							})
					})
			},
			backClick(){
				uni.navigateBack({
					
				})
			}
		}
	}
</script>

<style lang="scss">
	.successsynpopup{
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		width: 690rpx;
		box-sizing: border-box;
		padding-bottom: 47rpx;
		border-radius: 20rpx;
		.resurrectiontitle{
			line-height: 48rpx;
			width: 472rpx;
			margin-bottom: 59rpx;
			text-align: center;
		}
		.stroke{
			display: flex;
			align-items: center;
			justify-content: center;
			margin-bottom: 47rpx;
			.stroke_text{
				position: absolute;
				height: 130rpx;
				width:130rpx;
				border-radius: 50%;
				display: flex;
				justify-content: center;
				align-items: center;
				.text1{
					font-weight:800;
				}
			}
		}
		.other{
			margin-bottom: 25rpx;
		}
		.username{
			margin-bottom: 43rpx;
		}
		.getnumber{
			margin-bottom: 91rpx;
		}
		.avatar{
			width: 151rpx;
			height: 151rpx;
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			position: relative;
			margin-bottom: 23rpx;
			.image1{
				width: 126rpx;
				height: 126rpx;
				border-radius: 50%;
				background-color: #FFFFFF;
				z-index: 1;
			}
		}
		.popuptopfile{
			top: -180rpx;
			position: absolute;
			width: 139rpx;
			height: 168rpx;
			
		}
		.popuptop{
			width: 346rpx;
			height: 324rpx;
			top: -286rpx;
			position: absolute;
		}
		.successbtn{
			display: flex;
			align-items: center;
			justify-content: center;
			width: 419rpx;
			height: 88rpx;
			position: relative;
			background-color: rgba(0,0,0,0);
			margin-bottom: 50rpx;
			&::after{
				border:none;
				background: none;
				margin: 0;
				padding: 0;
			}
			.answervideo{
				width: 37rpx;
				height: 32rpx;
				margin-right: 21rpx;
				z-index: 1;
			}
			
		}
		.filebtn{
			display: flex;
			align-items: center;
			justify-content: center;
			width: 419rpx;
			height: 88rpx;
			position: relative;
			margin-top: -29rpx;
			.answervideo{
				width: 37rpx;
				height: 32rpx;
				margin-right: 21rpx;
				z-index: 1;
			}
		}
		.successtop{
			width: 415rpx;
			height: 131rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			position: relative;
			margin-top: -50rpx;
			margin-bottom: 27rpx;
		}
	}
	.progressindex{
		display: flex;
		align-items: center;
		position: relative;
		justify-content: space-between;
		margin-top: 61rpx;
		box-sizing: border-box;
		padding: 0 30rpx;
		.progressline{
			width: 550rpx;
			height: 20rpx;
			border-radius: 10rpx;
			display: flex;
			align-items: center;
			.progresslinein{
				height: 20rpx;
				border-radius: 10rpx;
			}
		}
		.numbertext{
			position: absolute;
			bottom: -25rpx;
			left: 350rpx;
		}
		.image1{
			width: 54rpx;
			height: 60rpx;
		}
		.image2{
			width: 45rpx;
			height: 53rpx;
		}
	}
	.answerindex{
		width: 690rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		position: relative;
		border-radius: 10rpx;
		margin: 0 auto;
		padding: 133rpx 0 54rpx 29rpx;
		.btn{
			width: 500rpx;
			height: 100rpx;
			border-radius: 50rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			position: relative;
			margin-bottom: 40rpx;
			.yesimg{
				position: absolute;
				right: 30rpx;
				width: 41rpx;
				height: 30rpx;
			}
			.noimg{
				position: absolute;
				right: 30rpx;
				width: 37rpx;
				height: 36rpx;
			}
		}
		.questiontext{
			line-height: 48rpx;
			width: 595rpx;
			margin-bottom: 60rpx;
		}
		.stroke{
			position: absolute;
			top: -73rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			.stroke_text{
				position: absolute;
				height: 130rpx;
				width:130rpx;
				border-radius: 50%;
				display: flex;
				justify-content: center;
				align-items: center;
				.text1{
					font-weight:800;
				}
			}
		}
	}
	.listindex{
		box-sizing: border-box;
		height: 108rpx;
		width: 404rpx;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 20rpx 32rpx;
		margin-bottom: 134rpx;
		position: relative;
		.userinfo{
			display: flex;
			flex-direction: column;
			z-index: 1;
			.text1{
				margin-bottom: 14rpx;
			}
		}
		.avatar{
			width: 68rpx;
			height: 68rpx;
			border-radius: 50%;
			margin-right: 22rpx;
			z-index: 1;
		}
	}
	.content{
		min-height: 100vh;
		width: 750rpx;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		padding-bottom: 70rpx;
	}
	.topTitle{
		color: #FFFFFF;
		display: flex;
		align-items: center;
		height: 67rpx;
		justify-content: center;
		position: absolute;
		z-index: 10;
		width: 100%;
		.back{
			width: 20rpx;
			height: 31rpx;
			position: absolute;
			left: 31rpx;
		}
	}
</style>
